package service

import (
	"ksd-social-api/commons/base/service"
	"ksd-social-api/modules/msg/mapper"
	"ksd-social-api/modules/msg/model"
	"ksd-social-api/modules/msg/model/context"
	"ksd-social-api/utils"
)

type MessageSystemService struct {
	service.BaseService
}

var messageSystemMapper = mapper.MessageSystemMapper{}

/**
 * 保存系统消息
 * @author feige
 * @date 2023-11-03
 * @version 1.0
 * @desc
 */
func (service *MessageSystemService) SaveMessageSystem(userId uint64, ctx *context.MessageSystemContext) bool {
	var messageSystem model.MessageSystem
	utils.CopyProperties(&messageSystem, ctx)
	messageSystem.SystemId = ctx.SystemId
	return messageSystemMapper.SaveMessageSystem(userId, ctx.SystemId, &messageSystem)
}

/**
 * 根据ID删除文章评论消息
 * @author feige
 * @date 2023-11-03
 * @version 1.0
 * @desc
 */
func (service *MessageSystemService) DelMessageSystemById(id int, systemId uint64) bool {
	return messageSystemMapper.DelMessageSystemById(id, systemId)
}

/**
 * @desc 根据ID查询我的消息
 * @author feige
 * @date 2023-11-14
 * @version 1.0
 */
func (service *MessageSystemService) GetMessageSystemById(id int, systemId uint64) (*model.MessageSystem, error) {
	return messageSystemMapper.GetMessagSystemById(id, systemId)
}
